package com.hzz.hzzgateway.base;


public enum CommonResultCode implements ResultCode {

    /**
     * 成功. ErrorCode : 0
     */
    SUCCESS("0", "成功"),
    /**
     * 未知异常. ErrorCode : 01
     */
    UnknownException("999", "服务器忙,请稍后重试"),
    /**
     * 系统异常. ErrorCode : 02
     */
    SystemException("500", "系统异常"),
    /**
     * 业务错误. ErrorCode : 03
     */
    BusinessException("502", "业务错误"),

    RemoteCallException("555", "远程调用错误"),

    /**
     * 岗亭指令执行错误. ErrorCode : 03
     */
    OrderCodeException("503", "岗亭指令执行错误"),

    /**
     * 提示级错误. ErrorCode : 04
     */
    InfoException("04", "提示级错误"),
    /**
     * 数据库操作异常. ErrorCode : 020001
     */
    DBException("777", "数据库操作异常"),

    AuthenticationFailure("401", "用户异常!"),

    AuthenticationExpiredFailure("10401", "AccessToken已过期"),
    /**
     * 无权限
     */
    SC_FORBIDDEN("403", "无权限"),


    /**
     * 参数验证错误. ErrorCode : 040001
     */
    ParamException("410", "参数验证错误"),

    SystemMaintainException("111", "系统正在维护中,请稍后重试"),
	
	payMoneyUnequalException("1101","支付金额已更新,请刷新页面");

    public final String code;
    public final String msg;

    CommonResultCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static CommonResultCode getByCode(String code) {
        for (CommonResultCode ec : CommonResultCode.values()) {
            if (ec.getCode().equals(code)) {
                return ec;
            }
        }
        return null;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }
}
